#ifndef EVENT_H
#define EVENT_H

#include <QObject>
#include <QMetaType>
#include <QDateTime>
#include "Constants.h"

const quint32 INVALID_ID = -1;

class Event
{
public:
   enum Category
   {
      INVALID = -1,
      CATASTROHPIC = 0,
      CRITICAL = 1,
      CAUTIONARY = 2,
      OPERATIONAL = 3,
   };

   Event();
   Event(quint32 id,
         QList<QString> parameters);

   quint32 id() const;
   Category category() const;
   QString name() const;
   QString message() const;
   QDateTime timestamp() const;
   QList<QString> parameters() const;

   void setId(quint32 id);
   void setCategory(Category category);
   void setName(QString name);
   void setMessage(QString message);
   void setParameters(QList<QString> parameters);

   QString serializeEvent();

protected:
   quint32 theId;
   Category theCategory;
   QString theName;
   QString theMessage;
   QDateTime theTimestamp;
   QList<QString> theParameters;
};

Q_DECLARE_METATYPE(Event)

#define EMPTY_PARAMS \
   QList<QString>()

#define LOG_EVENT(id, parameters) \
   emit signalPublishEvent(Event(id, parameters));

#endif // EVENT_H
